<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN" xml:lang="zh-CN">

<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <meta name="Keywords" content="水果屏幕"/>
    <meta name="Description" content="水果屏幕"/>
    <title>水果屏幕</title>
    <!-- <link rel="shortcut icon" type="image/x-icon" href="img/ouyuan.ico" media="screen" />
    <link rel="bookmark" href="img/ouyuan.ico"/> -->
    <link href="<?php echo base_url("/images/main.css"); ?>" rel="stylesheet" type="text/css"/>
</head>

<body>
<div class="all">
<!-- head -->
<div class="top">
    <div class="title"><span><?php echo $pipe['title']; ?></span>

        <p>号流水线&nbsp;&nbsp;<i>[<?php if ($pipe['status'] == 1) {
                    echo "正常";
                } else {
                    echo "暂停";
                } ?>]</i></p></div>
    <div class="select">
        <div class="selecttitle"><a href="#"></a></div>
        <div class="selectcontent" style="display: none;">
            <?php foreach ($pipe_arr as $pipe_name => $pipe_title) { ?>
                <?php if ($pipe_name != $pipe['name']) { ?>
                    <a href="<?php echo site_url("c=pipeline&m=signboard&pipe_name=" . $pipe_name ); ?>"><?php echo $pipe_title; ?>号流水线</a>
                <?php } ?>
            <?php } ?>
        </div>
    </div>
    <marquee class="marquee" direction="left" loop="-1" behavior="scroll" dataformatas="html" scrolldelay="130"
             scrollamount="4">
        <?php echo $other_pipe_statistica; ?>
    </marquee>
    <div class="title date"><p id="show_time" week="<?php echo $week; ?>"><?php echo date('Y-m-d H:i:s', time()); ?>
            &nbsp;星期<?php echo $week; ?></p></div>
</div>

<div class="head">
    <div class="line1">
        <div class="tils"></div>
        <div class="number" style="overflow: hidden;">
            <?php if ($deliver_goods) {
                foreach ($deliver_goods as $tmp) { ?>
                    <span class="coatnumb"><span class="outnumber"></span><span
                            class="colornumb"><?php echo $tmp['work_counter']; ?></span><span
                            class="insidenumber"></span></span>
                <?php }
            } ?>
        </div>
    </div>

    <div class="line1 line2">
        <div class="tils tils2"></div>
        <div class="number" style="overflow: hidden;">
            <?php if ($working) {
                foreach ($working as $tmp) { ?>
                    <span class="coatnumb"><span class="outnumber outnumber2"></span><span
                            class="colornumb colornumb2"><?php echo $tmp['work_counter']; ?></span><span
                            class="insidenumber insidenumber2"></span>
                        <?php if ($tmp['flag']) { ?><span class="que"></span><? } ?></span>
                <?php }
            } ?>

        </div>
    </div>
</div>
<!-- head -->
<!-- body -->
<div class="body">
    <!-- 左边 -->
    <div class="tableft"  <?php if(!$pipe['list']){ ?> style="background-color: #000;" <?php } ?>>
        <?php foreach ($pipe['list'] as $i => $pipe_node) { ?>
            <!-- 组1 -->
            <div class="fhz">
                <div class="fhtitle">
                    <div class="ddnumb">订单号：<?php echo $pipe_node['work_code']; ?></div>
                    <div class="tip">
                        <div class="tipin"><?php echo $pipe_node['work_counter']; ?></div>
                    </div>
                    <div class="clock <?php if ($i == 0) { ?>use_time_title<?php } ?>"
                         time_original="<?php echo $pipe_node['use_time_original']; ?>"><?php echo $pipe_node['use_time']; ?></div>
                </div>
                <table class="fjing">
                    <col width="8%"/>
                    <col width="70"/>
                    <col width="58%"/>
                    <col width="30%"/>
                    <?php foreach ($pipe_node['info'] as $k => $spec) { ?>
                        <tr <?php if ($k % 2 == 0){ ?>class="qian" <?php } ?>>
                            <th><?php echo $k + 1; ?></th>
                            <td><img
                                    src="http://image01.huicj.com/upload/store/goods/13/<?php echo $spec['wi_img']; ?>"
                                    alt="商品"/></td>
                            <td><?php echo $spec['wi_title']; ?></td>
                            <td class="align">
                                <b><?php echo $spec['wi_num']; ?></b>&nbsp;<em><?php echo $spec['wi_unit']; ?></em>
                            </td>
                        </tr>
                    <?php } ?>
                    <tr>
                        <td colspan="4">
                            <table class="liuyan">
                                <col width="17%"/>
                                <col width="83%"/>
                                <tr>
                                    <th>客户联系:</th>
                                    <td><?php echo $pipe_node['buyer_name'] ?>
                                        &nbsp;<?php echo $pipe_node['phone'] ?></td>
                                </tr>
                                <tr>
                                    <th>备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</th>
                                    <td><?php echo $pipe_node['order_message']; ?></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- 组1 -->
        <?php } ?>
    </div>
    <!-- 左边 -->
    <!-- 中间 -->
    <div class="tabmid">
        <div class="fhz fhz2">
            <table class="fjcontent">
                <col width="30%"/>
                <col width="21%"/>
                <col width="12%"/>
                <col width="21%"/>
                <col width="16%"/>
                <tr>
                    <th align="left">&nbsp;品&nbsp;&nbsp;名</th>
                    <th>待分拣</th>
                    <th>单位</th>
                    <th>总分拣数</th>
                    <th>已分拣</th>
                </tr>
                <?php $index = 0;
                foreach ($statistica as $k => $info) {
                    ?>
                    <tr <?php if ($index++ % 2 == 0) { ?> class="qian"<?php } ?>>
                        <td class="left" width="78" title="<?php echo $info['title']; ?>">
                            <div style="height: 78px;overflow: hidden;"><?php echo $info['title']; ?></div>
                        </td>
                        <td class="bling"><?php echo $info['wait_num']; ?></td>
                        <td><?php echo $info['unit']; ?></td>
                        <td><?php echo $info['all_num']; ?></td>
                        <td><?php echo $info['already_num']; ?></td>
                    </tr>
                <?php
                }
                unset($index); ?>
            </table>
        </div>
    </div>
    <!-- 中间 -->
    <!-- 右边 -->
    <div class="tabright" <?php if(!$pipe['hang_up']){ ?> style="background-color: #000;" <?php } ?>>
        <?php foreach ($pipe['hang_up'] as $hang_up) { ?>
            <!-- 组1 -->
            <div class="fhz fhz3">
                <div class="fhtitle fhtitle2">
                    <div class="ddnumb ddnumb2">订单号：<?php echo $hang_up['work_code']; ?></div>
                    <div class="tip">
                        <div class="tipin"><?php echo $hang_up['work_counter']; ?></div>
                    </div>
                    <div class="clock hu_time_title"
                         time_original="<?php echo $hang_up['hu_time_original']; ?>"><?php echo $hang_up['hu_time']; ?></div>
                </div>
                <table class="fjing fjing2">
                    <col width="9%"/>
                    <col width="61%"/>
                    <col width="31%"/>
                    <?php foreach ($hang_up['info'] as $k => $spec) { ?>
                        <tr <?php if ($k % 2 == 0){ ?>class="qian2" <?php }else { ?>class="qian3"<?php } ?>>
                            <th><?php echo $k + 1; ?></th>
                            <td><?php echo $spec['wi_title']; ?></td>
                            <td class="align">
                                <b><?php echo $spec['wi_num']; ?></b>&nbsp;<em><?php echo $spec['wi_unit']; ?></em>
                            </td>
                        </tr>
                    <?php } ?>

                    <tr>
                        <td colspan="3">
                            <table class="liuyan">
                                <col width="20%"/>
                                <col width="80%"/>
                                <tr>
                                    <th>客户联系:</th>
                                    <td><?php echo $hang_up['buyer_name']; ?>
                                        &nbsp;<?php echo $hang_up['phone']; ?></td>
                                </tr>
                                <tr>
                                    <th>备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</th>
                                    <td><?php echo $hang_up['order_message']; ?></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- 组1 -->
        <?php } ?>
    </div>
    <!-- 右边 -->
</div>
<!-- body -->
<!-- foot -->
<div class="foot">
    <div class="floatl">
        <div class="xs"><i><?php echo $pipe['title']; ?>:</i>&nbsp;正在分拣:&nbsp;<b><?php echo $pipe['pipeline_count']; ?></b></div>
        <div class="xs">缺货分拣:&nbsp;<b><?php echo $pipe['hang_up_count']; ?></b></div>
        <div class="xs">今日已分拣:&nbsp;<b><?php echo $pipe['self_count']; ?></b></div>
    </div>
    <div class="floatr">
        <div class="xs">当前排队总数:&nbsp;<b><?php echo $pipe['wl_count']; ?></b></div>
        <div class="xs">待分拣总数:&nbsp;<b><?php echo $pipe['p_h_count']; ?></b></div>
        <div class="xs">
            已分拣总数:&nbsp;<b><?php echo($pipe['all_count'] - $pipe['wl_count'] - $pipe['p_h_count']); ?></b></div>
        <div class="xs">今日订单总数:&nbsp;<b><?php echo $pipe['all_count']; ?></b></div>
    </div>
</div>
<!-- foot -->
</div>

<script type="text/javascript" src="<?php echo base_url("/javascript/jquery-1.8.0.min.js"); ?>"
        charset="utf-8"></script>
<script type="text/javascript">
    function get_time_str($time) {
        var $s = $time % 60;
        $s = "0" + $s;
        var $m = parseInt($time / 60);
        $m = "0" + $m;
        var $str = $m.substr($m.length - 2) + ':' + $s.substr($s.length - 2);
        return $str;
    }

    /**
     * 时间对象的格式化;
     */
    Date.prototype.format = function (format) {
        /*
         * eg:format="YYYY-MM-dd hh:mm:ss";
         */
        var o = {
            "M+": this.getMonth() + 1, // month
            "d+": this.getDate(), // day
            "h+": this.getHours(), // hour
            "m+": this.getMinutes(), // minute
            "s+": this.getSeconds(), // second
            "q+": Math.floor((this.getMonth() + 3) / 3), // quarter
            "S": this.getMilliseconds()
            // millisecond
        }

        if (/(y+)/.test(format)) {
            format = format.replace(RegExp.$1, (this.getFullYear() + "")
                .substr(4 - RegExp.$1.length));
        }

        for (var k in o) {
            if (new RegExp("(" + k + ")").test(format)) {
                format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k]
                    : ("00" + o[k]).substr(("" + o[k]).length));
            }
        }
        return format;
    }

    var $show_time = $("#show_time");
    var $tabmid = $(".tabmid");
    var tabmid_scroll_status = 0; //0：停止  1：向上滚动  2；向下滚动
    var h = 0;

    function refresh() {
        location.href = '<?php echo site_url("c=pipeline&m=signboard&pipe_name=" . $pipe['name'] ); ?>';
    }
    function loop() {
        var time_str = new Date().format("yyyy-MM-dd  hh:mm:ss");
        time_str += ' &nbsp;星期';
        time_str += $show_time.attr('week');
        $show_time.html(time_str);//

        $(".use_time_title, .hu_time_title").each(function (i, n) {
            var time_original = $(n).attr("time_original");

            time_original++;
            $(n).html(get_time_str(time_original));
            $(n).attr("time_original", time_original);

        });
        $.get('<?php echo site_url("c=pipeline&m=check_pipe_mark&pipe_name=" . $pipe['name'] . "&old_mark=" . $pipe['mark']); ?>', {}, function (data) {
            if (data == 'FALSE') {
                refresh();
            }
        })

        //处理滚动
        if (tabmid_scroll_status == 0) {
            if ($tabmid.scrollTop() < (h - 10)) {
                tabmid_scroll_status = 1;
                $tabmid.animate({scrollTop: h + 'px'}, 80000, function () {
                    tabmid_scroll_status = 0;
                });
            }
            else {
                tabmid_scroll_status = 1;
                $tabmid.animate({scrollTop: '0px'}, 80000, function () {
                    tabmid_scroll_status = 0;
                });
            }
        }
    }
    setInterval('loop()', 1000);
    var t = false;

    var t_selectcontent = false;
    function close_selectcontent() {
        $(".selectcontent").hide();
    }
    $(function () {
        h = $tabmid[0].scrollHeight - $tabmid.height();

        $tabmid.mousemove(function () {
            $tabmid.stop(true);
            t && clearTimeout(t);
            t = setTimeout('tabmid_scroll_status = 0', 1000);
        });

        $(".selecttitle").mouseenter(function () {
            $(".selectcontent").show();
        }).mouseleave(function () {
                t_selectcontent = setTimeout('close_selectcontent()', 1000);
            });
        $(".selectcontent").mouseenter(function(){
            t_selectcontent && clearTimeout(t_selectcontent);
        }).mouseleave(function(){
                close_selectcontent();
            });
    });
</script>
</body>

</html>
